home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / maths / querydlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  1.8 KB  |  80 lines

  1. // QueryDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "maths.h"
  6. #include "QueryDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CQueryDlg dialog
  16.  
  17.  
  18. CQueryDlg::CQueryDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CQueryDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CQueryDlg)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. void CQueryDlg::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(CQueryDlg)
  31.         // NOTE: the ClassWizard will add DDX and DDV calls here
  32.     //}}AFX_DATA_MAP
  33. }
  34.  
  35.  
  36. BEGIN_MESSAGE_MAP(CQueryDlg, CDialog)
  37.     //{{AFX_MSG_MAP(CQueryDlg)
  38.     ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
  39.     ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
  40.     //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CQueryDlg message handlers
  45.  
  46. int CQueryDlg::GetChoice()
  47. {
  48.     return m_idChoice;
  49. }
  50.  
  51. BOOL CQueryDlg::OnInitDialog() 
  52. {
  53.     CDialog::OnInitDialog();
  54.     
  55.     m_strChoice1.LoadString(IDS_MATH1);
  56.     m_strChoice2.LoadString(IDS_MATH2);
  57.     m_strChoice3.LoadString(IDS_MATH3);
  58.  
  59.     CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST1);
  60.     pList->AddString(m_strChoice1);
  61.     pList->AddString(m_strChoice2);
  62.     pList->AddString(m_strChoice3);
  63.  
  64.     return TRUE;  // return TRUE unless you set the focus to a control
  65.                   // EXCEPTION: OCX Property Pages should return FALSE
  66. }
  67.  
  68. void CQueryDlg::OnSelchangeList1() 
  69. {
  70.     CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST1);
  71.     m_idChoice = pList->GetCurSel();
  72. }
  73.  
  74. void CQueryDlg::OnDblclkList1() 
  75. {
  76.     CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST1);
  77.     m_idChoice = pList->GetCurSel();
  78.     EndDialog(IDOK);
  79. }
  80.